package console4;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import console4.widgets.ConsoleMainWindow;

public class Main {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Console 4");
		final ConsoleMainWindow mainWindow=new ConsoleMainWindow(shell);
		mainWindow.loadTabs();
		shell.setSize(800, 600);
		shell.open();
		mainWindow.resetFocus();
		shell.addDisposeListener(new DisposeListener() {
			@Override
			public void widgetDisposed(DisposeEvent e) {
				mainWindow.saveTabs();
			}
		});
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		// disposes all associated windows and their components
		display.dispose();
		//mainWindow.destroyThreads();
	}
}
